<?php defined('_JEXEC') or die('Restricted access'); ?>
<form action="index.php" method="post" name="adminForm" id="adminForm">
<div id="com_docario">
    <div id="cats100"> <!-- all life using this shit... for nothing-->
        <table cellspacing="0" cellpading="0" border="0" width="100%">
            <tr><td valign="top">
                <fieldset class="adminForm" width="100%">
                    <legend><?php echo JText::_('COM_DOCARIO_CATEGORY'); ?></legend>
                    <table class="adminForm"><tbody>
                        <tr>
                            <td width="100" align="right" class="key">
                                <legend for="category_name">
                                    <?php echo JText::_('COM_DOCARIO_NAME'); ?>
                                </legend>
                            </td>
                            <td>
                                <input type="text" name="category_name"
                                       id="category_name"
                                       value="<?php echo $this->category->name; ?>" />
                            </td>
                        </tr>
                        <tr>
                            <td width="100" align="right" class="key">
                                <legend for="category_alias">
                                    <?php echo JText::_('COM_DOCARIO_ALIAS'); ?>
                                </legend>
                            </td>
                            <td>
                                <input type="text" name="category_alias"
                                       id="category_alias"
                                       value="<?php echo $this->category->alias ?>" />
                            </td>
                        </tr>
                        <tr>
                            <td width="100" align="right" class="key">
                                <legend for="category_parent">
                                    <?php echo JText::_('COM_DOCARIO_PARENT_CATEGORY'); ?>
                                </legend>
                            </td>
                            <td>
                                <select name="category_parent" 
                                        id="category_parent">
                                    <option value="0">
                                        -<?php echo JText::_('COM_DOCARIO_NO_PARENT'); ?>-
                                    </option>
                                    <?php foreach ($this->categories as $category) { ?>
                                        <option value="<?php echo $category->id; ?>"
                                                <?php echo (($category->id==$this->category->parent_id)?'selected="selected"':''); ?>>
                                            <?php echo $category->name; ?>
                                        </option>
                                    <?php } ?>
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <td width="100" align="right" class="key">
                                <legend for="category_published">
                                    <?php echo JText::_('CATEGORY_PUBLISHED'); ?>
                                </legend>
                            </td>
                            <td>
                                <input type="checkbox" name="category_published"
                                       id="category_published" value="1"
                                       checked="checked" />
                            </td>
                        </tr>
                    </tbody></table>
                    <div class="category_editor">
                        <?php
                            $editor = JFactory::getEditor();
                            $params = array(
                                'smilies' => '0',
                                'style' => '1',
                                'layer' => '0',
                                'table' => '0',
                                'clear_entities' => '0'
                            );
                            echo $editor->display('category_description', $this->category->description,
                                                  '650', '400', '20', '20', false,
                                                  $params);
                        ?>
                    </div>
                </fieldset>
            </td></tr>
        </table>
    </div>
    <div id="cats010"> <!-- right column -->
        <?php if ($this->category->id) { ?>
        <div id="cats011"> <!-- top column -->
            <fieldset class="adminForm" width="100%">
                <legend><?php echo JText::_('COM_DOCARIO_GROUPS'); ?></legend>
                <div class="perm_content">
                    <table>
                        <thead>
                            <th><?php echo JText::_('COM_DOCARIO_NAME'); ?></th>
                            <th><?php echo JText::_('COM_DOCARIO_READ'); ?></th>
                            <th><?php echo JText::_('COM_DOCARIO_WRITE'); ?></th>
                        </thead>
                        <tbody>
                        <?php $k = 0; foreach ($this->groups as $group) { ?>
                            <tr class="row<?php echo $k; ?>">
                                <td class="name"><?php echo $group->name; ?></td>
                                <td class="perm"><div class="<?php echo $group->css_read; ?>" id="cgr<?php echo $group->id; ?>">
                                    <select name="greadselect" class="grs" id="grs<?php echo $group->id; ?>">
                                        <option value="0" <?php echo (($group->read == 0)?'selected="selected"':''); ?>>
                                            <?php echo JText::_('NO'); ?>
                                        </option>
                                        <option value="1" <?php echo (($group->read == 1)?'selected="selected"':''); ?>>
                                            <?php echo JText::_('YES'); ?>
                                        </option>
                                    </select>
                                </div></td>
                                <td class="perm"><div class="<?php echo $group->css_write; ?>" id="cgw<?php echo $group->id; ?>">
                                    <select name="gwriteselect" class="gws" id="gws<?php echo $group->id; ?>">
                                        <option value="0" <?php echo (($group->write == 0)?'selected="selected"':''); ?>>
                                            <?php echo JText::_('NO'); ?>
                                        </option>
                                        <option value="1" <?php echo (($group->write == 1)?'selected="selected"':''); ?>>
                                            <?php echo JText::_('YES'); ?>
                                        </option>
                                    </select>
                                </div></td>
                            </tr>
                        <?php $k = 1 - $k; } ?>
                        </tbody>
                    </table>
                </div>
            </fieldset>
        </div>
        <div id="cats012">
            <fieldset class="adminForm" width="100%">
                <legend><?php echo JText::_('COM_DOCARIO_USERS'); ?></legend>
                <div class="search_area">
                    <label for="user_search"><?php echo JText::_('SEARCH'); ?></label>
                    <input type="text" id="user_search" name="user_search" class="user_search" />
                </div>
                <div class="perm_content">
                    <table>
                        <thead>
                            <th><?php echo JText::_('COM_DOCARIO_NAME'); ?></th>
                            <th><?php echo JText::_('COM_DOCARIO_READ'); ?></th>
                            <th><?php echo JText::_('COM_DOCARIO_WRITE'); ?></th>
                        </thead>
                        <tbody id="user_table">
                        <?php $k = 0; foreach ($this->users as $user) { ?>
                            
                        <?php $k = 1 - $k; } ?>
                        </tbody>
                    </table>
                </div>
            </fieldset>
        </div>
        <?php } else { ?>
            <?php echo JText::_('COM_DOCARIO_CATEGORY_NOT_CREATED'); ?>
        <?php } ?>
    </div>
    <div class="clear"></div>
</div>

<input type="hidden" name="controller" id="controller" value="category" />
<input type="hidden" name="option" id="option" value="com_docario" />
<input type="hidden" name="task" id="task" value="" />
<input type="hidden" name="category_id" id="category_id" value="<?php echo $this->category->id; ?>" />
<input type="hidden" name="baseurl" id="baseurl" value="<?php echo JURI::base(); ?>" />

</form>
